{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "('username: 15010492066', '0,')"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import jaqs\n",
    "from jaqs.data import DataApi\n",
    "\n",
    "api = DataApi(addr=\"tcp://data.quantos.org:8910\")\n",
    "\n",
    "api.login(\"15010492066\", \"eyJhbGciOiJIUzI1NiJ9.eyJjcmVhdGVfdGltZSI6IjE1MTMwNTA0ODY3MTQiLCJpc3MiOiJhdXRoMCIsImlkIjoiMTUwMTA0OTIwNjYifQ.s_530n20Aelg7-8-1IorTgoa_yp6goImz20hhGIzMGU\") \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# 获取交易日历\n",
    "df, msg = api.query(\n",
    "                view=\"jz.secTradeCal\", \n",
    "                fields=\"trade_date,istradeday, isweekday, isweekend, isholiday\", \n",
    "                filter=\"start_date=20180101&end_date=20180301\", \n",
    "                data_format='pandas')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>isholiday</th>\n",
       "      <th>istradeday</th>\n",
       "      <th>isweekday</th>\n",
       "      <th>isweekend</th>\n",
       "      <th>trade_date</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>F</td>\n",
       "      <td>T</td>\n",
       "      <td>T</td>\n",
       "      <td>F</td>\n",
       "      <td>20180102</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>F</td>\n",
       "      <td>T</td>\n",
       "      <td>T</td>\n",
       "      <td>F</td>\n",
       "      <td>20180103</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>F</td>\n",
       "      <td>T</td>\n",
       "      <td>T</td>\n",
       "      <td>F</td>\n",
       "      <td>20180104</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>F</td>\n",
       "      <td>T</td>\n",
       "      <td>T</td>\n",
       "      <td>F</td>\n",
       "      <td>20180105</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>F</td>\n",
       "      <td>T</td>\n",
       "      <td>T</td>\n",
       "      <td>F</td>\n",
       "      <td>20180108</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>F</td>\n",
       "      <td>T</td>\n",
       "      <td>T</td>\n",
       "      <td>F</td>\n",
       "      <td>20180109</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>F</td>\n",
       "      <td>T</td>\n",
       "      <td>T</td>\n",
       "      <td>F</td>\n",
       "      <td>20180110</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>F</td>\n",
       "      <td>T</td>\n",
       "      <td>T</td>\n",
       "      <td>F</td>\n",
       "      <td>20180111</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>F</td>\n",
       "      <td>T</td>\n",
       "      <td>T</td>\n",
       "      <td>F</td>\n",
       "      <td>20180112</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>F</td>\n",
       "      <td>T</td>\n",
       "      <td>T</td>\n",
       "      <td>F</td>\n",
       "      <td>20180115</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>F</td>\n",
       "      <td>T</td>\n",
       "      <td>T</td>\n",
       "      <td>F</td>\n",
       "      <td>20180116</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>F</td>\n",
       "      <td>T</td>\n",
       "      <td>T</td>\n",
       "      <td>F</td>\n",
       "      <td>20180117</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>F</td>\n",
       "      <td>T</td>\n",
       "      <td>T</td>\n",
       "      <td>F</td>\n",
       "      <td>20180118</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>F</td>\n",
       "      <td>T</td>\n",
       "      <td>T</td>\n",
       "      <td>F</td>\n",
       "      <td>20180119</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>F</td>\n",
       "      <td>T</td>\n",
       "      <td>T</td>\n",
       "      <td>F</td>\n",
       "      <td>20180122</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>F</td>\n",
       "      <td>T</td>\n",
       "      <td>T</td>\n",
       "      <td>F</td>\n",
       "      <td>20180123</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>F</td>\n",
       "      <td>T</td>\n",
       "      <td>T</td>\n",
       "      <td>F</td>\n",
       "      <td>20180124</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>F</td>\n",
       "      <td>T</td>\n",
       "      <td>T</td>\n",
       "      <td>F</td>\n",
       "      <td>20180125</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>F</td>\n",
       "      <td>T</td>\n",
       "      <td>T</td>\n",
       "      <td>F</td>\n",
       "      <td>20180126</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>F</td>\n",
       "      <td>T</td>\n",
       "      <td>T</td>\n",
       "      <td>F</td>\n",
       "      <td>20180129</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>F</td>\n",
       "      <td>T</td>\n",
       "      <td>T</td>\n",
       "      <td>F</td>\n",
       "      <td>20180130</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>F</td>\n",
       "      <td>T</td>\n",
       "      <td>T</td>\n",
       "      <td>F</td>\n",
       "      <td>20180131</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>F</td>\n",
       "      <td>T</td>\n",
       "      <td>T</td>\n",
       "      <td>F</td>\n",
       "      <td>20180201</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>F</td>\n",
       "      <td>T</td>\n",
       "      <td>T</td>\n",
       "      <td>F</td>\n",
       "      <td>20180202</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>F</td>\n",
       "      <td>T</td>\n",
       "      <td>T</td>\n",
       "      <td>F</td>\n",
       "      <td>20180205</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>F</td>\n",
       "      <td>T</td>\n",
       "      <td>T</td>\n",
       "      <td>F</td>\n",
       "      <td>20180206</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>F</td>\n",
       "      <td>T</td>\n",
       "      <td>T</td>\n",
       "      <td>F</td>\n",
       "      <td>20180207</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>F</td>\n",
       "      <td>T</td>\n",
       "      <td>T</td>\n",
       "      <td>F</td>\n",
       "      <td>20180208</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>F</td>\n",
       "      <td>T</td>\n",
       "      <td>T</td>\n",
       "      <td>F</td>\n",
       "      <td>20180209</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>F</td>\n",
       "      <td>T</td>\n",
       "      <td>T</td>\n",
       "      <td>F</td>\n",
       "      <td>20180212</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>F</td>\n",
       "      <td>T</td>\n",
       "      <td>T</td>\n",
       "      <td>F</td>\n",
       "      <td>20180213</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>31</th>\n",
       "      <td>F</td>\n",
       "      <td>T</td>\n",
       "      <td>T</td>\n",
       "      <td>F</td>\n",
       "      <td>20180214</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>F</td>\n",
       "      <td>T</td>\n",
       "      <td>T</td>\n",
       "      <td>F</td>\n",
       "      <td>20180222</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>33</th>\n",
       "      <td>F</td>\n",
       "      <td>T</td>\n",
       "      <td>T</td>\n",
       "      <td>F</td>\n",
       "      <td>20180223</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>34</th>\n",
       "      <td>F</td>\n",
       "      <td>T</td>\n",
       "      <td>T</td>\n",
       "      <td>F</td>\n",
       "      <td>20180226</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35</th>\n",
       "      <td>F</td>\n",
       "      <td>T</td>\n",
       "      <td>T</td>\n",
       "      <td>F</td>\n",
       "      <td>20180227</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36</th>\n",
       "      <td>F</td>\n",
       "      <td>T</td>\n",
       "      <td>T</td>\n",
       "      <td>F</td>\n",
       "      <td>20180228</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>37</th>\n",
       "      <td>F</td>\n",
       "      <td>T</td>\n",
       "      <td>T</td>\n",
       "      <td>F</td>\n",
       "      <td>20180301</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   isholiday istradeday isweekday isweekend trade_date\n",
       "0          F          T         T         F   20180102\n",
       "1          F          T         T         F   20180103\n",
       "2          F          T         T         F   20180104\n",
       "3          F          T         T         F   20180105\n",
       "4          F          T         T         F   20180108\n",
       "5          F          T         T         F   20180109\n",
       "6          F          T         T         F   20180110\n",
       "7          F          T         T         F   20180111\n",
       "8          F          T         T         F   20180112\n",
       "9          F          T         T         F   20180115\n",
       "10         F          T         T         F   20180116\n",
       "11         F          T         T         F   20180117\n",
       "12         F          T         T         F   20180118\n",
       "13         F          T         T         F   20180119\n",
       "14         F          T         T         F   20180122\n",
       "15         F          T         T         F   20180123\n",
       "16         F          T         T         F   20180124\n",
       "17         F          T         T         F   20180125\n",
       "18         F          T         T         F   20180126\n",
       "19         F          T         T         F   20180129\n",
       "20         F          T         T         F   20180130\n",
       "21         F          T         T         F   20180131\n",
       "22         F          T         T         F   20180201\n",
       "23         F          T         T         F   20180202\n",
       "24         F          T         T         F   20180205\n",
       "25         F          T         T         F   20180206\n",
       "26         F          T         T         F   20180207\n",
       "27         F          T         T         F   20180208\n",
       "28         F          T         T         F   20180209\n",
       "29         F          T         T         F   20180212\n",
       "30         F          T         T         F   20180213\n",
       "31         F          T         T         F   20180214\n",
       "32         F          T         T         F   20180222\n",
       "33         F          T         T         F   20180223\n",
       "34         F          T         T         F   20180226\n",
       "35         F          T         T         F   20180227\n",
       "36         F          T         T         F   20180228\n",
       "37         F          T         T         F   20180301"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# 证券基础信息\n",
    "df, msg = api.query(\n",
    "                view=\"jz.instrumentInfo\", \n",
    "                fields=\"\", \n",
    "                filter=\"\", \n",
    "                data_format='pandas')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>list_date</th>\n",
       "      <th>name</th>\n",
       "      <th>symbol</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0</td>\n",
       "      <td>沪深300</td>\n",
       "      <td>399300.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0</td>\n",
       "      <td>深证综指</td>\n",
       "      <td>399106.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0</td>\n",
       "      <td>深证100R</td>\n",
       "      <td>399004.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0</td>\n",
       "      <td>国企改革</td>\n",
       "      <td>399974.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0</td>\n",
       "      <td>深证成指</td>\n",
       "      <td>399001.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>0</td>\n",
       "      <td>中证军工</td>\n",
       "      <td>399967.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>0</td>\n",
       "      <td>创业板指</td>\n",
       "      <td>399006.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>0</td>\n",
       "      <td>深成指R</td>\n",
       "      <td>399002.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>0</td>\n",
       "      <td>成份Ｂ指</td>\n",
       "      <td>399003.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>0</td>\n",
       "      <td>中小板指</td>\n",
       "      <td>399005.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>0</td>\n",
       "      <td>深证300</td>\n",
       "      <td>399007.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>0</td>\n",
       "      <td>中小300</td>\n",
       "      <td>399008.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>0</td>\n",
       "      <td>深证200</td>\n",
       "      <td>399009.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>0</td>\n",
       "      <td>深证700</td>\n",
       "      <td>399010.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>0</td>\n",
       "      <td>深证1000</td>\n",
       "      <td>399011.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>0</td>\n",
       "      <td>创业300</td>\n",
       "      <td>399012.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>0</td>\n",
       "      <td>深市精选</td>\n",
       "      <td>399013.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>0</td>\n",
       "      <td>中小创新</td>\n",
       "      <td>399015.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>0</td>\n",
       "      <td>新 指 数</td>\n",
       "      <td>399100.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>0</td>\n",
       "      <td>中小板综</td>\n",
       "      <td>399101.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>0</td>\n",
       "      <td>创业板综</td>\n",
       "      <td>399102.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>0</td>\n",
       "      <td>乐富指数</td>\n",
       "      <td>399103.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>0</td>\n",
       "      <td>深证Ａ指</td>\n",
       "      <td>399107.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>0</td>\n",
       "      <td>深证Ｂ指</td>\n",
       "      <td>399108.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>0</td>\n",
       "      <td>农林指数</td>\n",
       "      <td>399231.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>0</td>\n",
       "      <td>采矿指数</td>\n",
       "      <td>399232.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>0</td>\n",
       "      <td>制造指数</td>\n",
       "      <td>399233.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>0</td>\n",
       "      <td>水电指数</td>\n",
       "      <td>399234.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>0</td>\n",
       "      <td>建筑指数</td>\n",
       "      <td>399235.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>0</td>\n",
       "      <td>批零指数</td>\n",
       "      <td>399236.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26155</th>\n",
       "      <td>0</td>\n",
       "      <td>铁矿石掉期6个月</td>\n",
       "      <td>i134.SPOT</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26156</th>\n",
       "      <td>0</td>\n",
       "      <td>铁矿石掉期7个月</td>\n",
       "      <td>i135.SPOT</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26157</th>\n",
       "      <td>0</td>\n",
       "      <td>铁矿石掉期8个月</td>\n",
       "      <td>i136.SPOT</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26158</th>\n",
       "      <td>0</td>\n",
       "      <td>铁矿石掉期9个月</td>\n",
       "      <td>i137.SPOT</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26159</th>\n",
       "      <td>0</td>\n",
       "      <td>铁矿石掉期10个月</td>\n",
       "      <td>i138.SPOT</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26160</th>\n",
       "      <td>0</td>\n",
       "      <td>铁矿石掉期11个月</td>\n",
       "      <td>i139.SPOT</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26161</th>\n",
       "      <td>0</td>\n",
       "      <td>铁矿石掉期12个月</td>\n",
       "      <td>i140.SPOT</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26162</th>\n",
       "      <td>0</td>\n",
       "      <td>铁矿石掉期13个月</td>\n",
       "      <td>i141.SPOT</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26163</th>\n",
       "      <td>0</td>\n",
       "      <td>铁矿石掉期14个月</td>\n",
       "      <td>i142.SPOT</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26164</th>\n",
       "      <td>0</td>\n",
       "      <td>USDCNY</td>\n",
       "      <td>USDCNY.FX</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26165</th>\n",
       "      <td>0</td>\n",
       "      <td>HKDCNY</td>\n",
       "      <td>HKDCNY.FX</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26166</th>\n",
       "      <td>0</td>\n",
       "      <td>HKDCNYSET</td>\n",
       "      <td>HKDCNYSET.FX</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26167</th>\n",
       "      <td>0</td>\n",
       "      <td>HKDCNYFIX</td>\n",
       "      <td>HKDCNYFIX.FX</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26168</th>\n",
       "      <td>0</td>\n",
       "      <td>原油</td>\n",
       "      <td>sc.INE</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26169</th>\n",
       "      <td>20180326</td>\n",
       "      <td>原油1809</td>\n",
       "      <td>sc1809.INE</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26170</th>\n",
       "      <td>20180326</td>\n",
       "      <td>原油1810</td>\n",
       "      <td>sc1810.INE</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26171</th>\n",
       "      <td>20180326</td>\n",
       "      <td>原油1811</td>\n",
       "      <td>sc1811.INE</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26172</th>\n",
       "      <td>20180326</td>\n",
       "      <td>原油1812</td>\n",
       "      <td>sc1812.INE</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26173</th>\n",
       "      <td>20180326</td>\n",
       "      <td>原油1901</td>\n",
       "      <td>sc1901.INE</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26174</th>\n",
       "      <td>20180326</td>\n",
       "      <td>原油1902</td>\n",
       "      <td>sc1902.INE</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26175</th>\n",
       "      <td>20180326</td>\n",
       "      <td>原油1903</td>\n",
       "      <td>sc1903.INE</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26176</th>\n",
       "      <td>20180326</td>\n",
       "      <td>原油1906</td>\n",
       "      <td>sc1906.INE</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26177</th>\n",
       "      <td>20180326</td>\n",
       "      <td>原油1909</td>\n",
       "      <td>sc1909.INE</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26178</th>\n",
       "      <td>20180326</td>\n",
       "      <td>原油1912</td>\n",
       "      <td>sc1912.INE</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26179</th>\n",
       "      <td>20180326</td>\n",
       "      <td>原油2003</td>\n",
       "      <td>sc2003.INE</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26180</th>\n",
       "      <td>20180326</td>\n",
       "      <td>原油2006</td>\n",
       "      <td>sc2006.INE</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26181</th>\n",
       "      <td>20180326</td>\n",
       "      <td>原油2009</td>\n",
       "      <td>sc2009.INE</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26182</th>\n",
       "      <td>20180326</td>\n",
       "      <td>原油2012</td>\n",
       "      <td>sc2012.INE</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26183</th>\n",
       "      <td>20180326</td>\n",
       "      <td>原油2103</td>\n",
       "      <td>sc2103.INE</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26184</th>\n",
       "      <td>20180402</td>\n",
       "      <td>sc1904</td>\n",
       "      <td>sc1904.INE</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>26185 rows × 3 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      list_date       name        symbol\n",
       "0             0      沪深300     399300.SZ\n",
       "1             0       深证综指     399106.SZ\n",
       "2             0     深证100R     399004.SZ\n",
       "3             0       国企改革     399974.SZ\n",
       "4             0       深证成指     399001.SZ\n",
       "5             0       中证军工     399967.SZ\n",
       "6             0       创业板指     399006.SZ\n",
       "7             0       深成指R     399002.SZ\n",
       "8             0       成份Ｂ指     399003.SZ\n",
       "9             0       中小板指     399005.SZ\n",
       "10            0      深证300     399007.SZ\n",
       "11            0      中小300     399008.SZ\n",
       "12            0      深证200     399009.SZ\n",
       "13            0      深证700     399010.SZ\n",
       "14            0     深证1000     399011.SZ\n",
       "15            0      创业300     399012.SZ\n",
       "16            0       深市精选     399013.SZ\n",
       "17            0       中小创新     399015.SZ\n",
       "18            0      新 指 数     399100.SZ\n",
       "19            0       中小板综     399101.SZ\n",
       "20            0       创业板综     399102.SZ\n",
       "21            0       乐富指数     399103.SZ\n",
       "22            0       深证Ａ指     399107.SZ\n",
       "23            0       深证Ｂ指     399108.SZ\n",
       "24            0       农林指数     399231.SZ\n",
       "25            0       采矿指数     399232.SZ\n",
       "26            0       制造指数     399233.SZ\n",
       "27            0       水电指数     399234.SZ\n",
       "28            0       建筑指数     399235.SZ\n",
       "29            0       批零指数     399236.SZ\n",
       "...         ...        ...           ...\n",
       "26155         0   铁矿石掉期6个月     i134.SPOT\n",
       "26156         0   铁矿石掉期7个月     i135.SPOT\n",
       "26157         0   铁矿石掉期8个月     i136.SPOT\n",
       "26158         0   铁矿石掉期9个月     i137.SPOT\n",
       "26159         0  铁矿石掉期10个月     i138.SPOT\n",
       "26160         0  铁矿石掉期11个月     i139.SPOT\n",
       "26161         0  铁矿石掉期12个月     i140.SPOT\n",
       "26162         0  铁矿石掉期13个月     i141.SPOT\n",
       "26163         0  铁矿石掉期14个月     i142.SPOT\n",
       "26164         0     USDCNY     USDCNY.FX\n",
       "26165         0     HKDCNY     HKDCNY.FX\n",
       "26166         0  HKDCNYSET  HKDCNYSET.FX\n",
       "26167         0  HKDCNYFIX  HKDCNYFIX.FX\n",
       "26168         0         原油        sc.INE\n",
       "26169  20180326     原油1809    sc1809.INE\n",
       "26170  20180326     原油1810    sc1810.INE\n",
       "26171  20180326     原油1811    sc1811.INE\n",
       "26172  20180326     原油1812    sc1812.INE\n",
       "26173  20180326     原油1901    sc1901.INE\n",
       "26174  20180326     原油1902    sc1902.INE\n",
       "26175  20180326     原油1903    sc1903.INE\n",
       "26176  20180326     原油1906    sc1906.INE\n",
       "26177  20180326     原油1909    sc1909.INE\n",
       "26178  20180326     原油1912    sc1912.INE\n",
       "26179  20180326     原油2003    sc2003.INE\n",
       "26180  20180326     原油2006    sc2006.INE\n",
       "26181  20180326     原油2009    sc2009.INE\n",
       "26182  20180326     原油2012    sc2012.INE\n",
       "26183  20180326     原油2103    sc2103.INE\n",
       "26184  20180402     sc1904    sc1904.INE\n",
       "\n",
       "[26185 rows x 3 columns]"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# 证券基础信息 指定查询的证券\n",
    "df, msg = api.query(\n",
    "                view=\"jz.instrumentInfo\", \n",
    "                fields=\"\", \n",
    "                filter=\"symbol=300033.SZ\", \n",
    "                data_format='pandas')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>list_date</th>\n",
       "      <th>name</th>\n",
       "      <th>symbol</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>20091225</td>\n",
       "      <td>同花顺</td>\n",
       "      <td>300033.SZ</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  list_date name     symbol\n",
       "0  20091225  同花顺  300033.SZ"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# 指数成分股\n",
    "df, msg = api.query(\n",
    "                view=\"lb.indexCons\", \n",
    "                fields=\"\", \n",
    "                filter=\"index_code=399300.SZ&start_date=20150101&end_date=20150102\", \n",
    "                data_format='pandas')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>in_date</th>\n",
       "      <th>index_code</th>\n",
       "      <th>out_date</th>\n",
       "      <th>symbol</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>20050408</td>\n",
       "      <td>399300.SZ</td>\n",
       "      <td></td>\n",
       "      <td>000001.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>20050408</td>\n",
       "      <td>399300.SZ</td>\n",
       "      <td></td>\n",
       "      <td>000002.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>20050408</td>\n",
       "      <td>399300.SZ</td>\n",
       "      <td>20171208</td>\n",
       "      <td>000009.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>20050408</td>\n",
       "      <td>399300.SZ</td>\n",
       "      <td>20151229</td>\n",
       "      <td>000024.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>20140616</td>\n",
       "      <td>399300.SZ</td>\n",
       "      <td>20170609</td>\n",
       "      <td>000027.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>20050408</td>\n",
       "      <td>399300.SZ</td>\n",
       "      <td>20170609</td>\n",
       "      <td>000039.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>20050408</td>\n",
       "      <td>399300.SZ</td>\n",
       "      <td></td>\n",
       "      <td>000060.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>20050408</td>\n",
       "      <td>399300.SZ</td>\n",
       "      <td>20170609</td>\n",
       "      <td>000061.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>20050408</td>\n",
       "      <td>399300.SZ</td>\n",
       "      <td></td>\n",
       "      <td>000063.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>20050408</td>\n",
       "      <td>399300.SZ</td>\n",
       "      <td></td>\n",
       "      <td>000069.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>20090105</td>\n",
       "      <td>399300.SZ</td>\n",
       "      <td></td>\n",
       "      <td>000100.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>20130701</td>\n",
       "      <td>399300.SZ</td>\n",
       "      <td>20171208</td>\n",
       "      <td>000156.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>20050408</td>\n",
       "      <td>399300.SZ</td>\n",
       "      <td></td>\n",
       "      <td>000157.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>20131216</td>\n",
       "      <td>399300.SZ</td>\n",
       "      <td>20160608</td>\n",
       "      <td>000400.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>20050408</td>\n",
       "      <td>399300.SZ</td>\n",
       "      <td>20150612</td>\n",
       "      <td>000401.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>20050408</td>\n",
       "      <td>399300.SZ</td>\n",
       "      <td></td>\n",
       "      <td>000402.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>20140616</td>\n",
       "      <td>399300.SZ</td>\n",
       "      <td></td>\n",
       "      <td>000413.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>20080102</td>\n",
       "      <td>399300.SZ</td>\n",
       "      <td></td>\n",
       "      <td>000423.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>20050408</td>\n",
       "      <td>399300.SZ</td>\n",
       "      <td></td>\n",
       "      <td>000425.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>20140616</td>\n",
       "      <td>399300.SZ</td>\n",
       "      <td></td>\n",
       "      <td>000503.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>20131216</td>\n",
       "      <td>399300.SZ</td>\n",
       "      <td>20150612</td>\n",
       "      <td>000536.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>20050701</td>\n",
       "      <td>399300.SZ</td>\n",
       "      <td></td>\n",
       "      <td>000538.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>20141215</td>\n",
       "      <td>399300.SZ</td>\n",
       "      <td></td>\n",
       "      <td>000559.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>20060703</td>\n",
       "      <td>399300.SZ</td>\n",
       "      <td>20150123</td>\n",
       "      <td>000562.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>20050408</td>\n",
       "      <td>399300.SZ</td>\n",
       "      <td></td>\n",
       "      <td>000568.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>20120104</td>\n",
       "      <td>399300.SZ</td>\n",
       "      <td>20160608</td>\n",
       "      <td>000581.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>20131216</td>\n",
       "      <td>399300.SZ</td>\n",
       "      <td>20160608</td>\n",
       "      <td>000598.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>20090105</td>\n",
       "      <td>399300.SZ</td>\n",
       "      <td></td>\n",
       "      <td>000623.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>20050408</td>\n",
       "      <td>399300.SZ</td>\n",
       "      <td></td>\n",
       "      <td>000625.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>20120104</td>\n",
       "      <td>399300.SZ</td>\n",
       "      <td>20160608</td>\n",
       "      <td>000629.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>270</th>\n",
       "      <td>20110701</td>\n",
       "      <td>399300.SZ</td>\n",
       "      <td>20161209</td>\n",
       "      <td>601098.SH</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>271</th>\n",
       "      <td>20110104</td>\n",
       "      <td>399300.SZ</td>\n",
       "      <td></td>\n",
       "      <td>601818.SH</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>272</th>\n",
       "      <td>20110701</td>\n",
       "      <td>399300.SZ</td>\n",
       "      <td></td>\n",
       "      <td>002500.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>273</th>\n",
       "      <td>20140616</td>\n",
       "      <td>399300.SZ</td>\n",
       "      <td>20161209</td>\n",
       "      <td>600998.SH</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>274</th>\n",
       "      <td>20141215</td>\n",
       "      <td>399300.SZ</td>\n",
       "      <td>20170609</td>\n",
       "      <td>300146.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>275</th>\n",
       "      <td>20110701</td>\n",
       "      <td>399300.SZ</td>\n",
       "      <td></td>\n",
       "      <td>601933.SH</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>276</th>\n",
       "      <td>20120702</td>\n",
       "      <td>399300.SZ</td>\n",
       "      <td>20151211</td>\n",
       "      <td>002570.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>277</th>\n",
       "      <td>20140616</td>\n",
       "      <td>399300.SZ</td>\n",
       "      <td></td>\n",
       "      <td>601216.SH</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>278</th>\n",
       "      <td>20120104</td>\n",
       "      <td>399300.SZ</td>\n",
       "      <td>20170609</td>\n",
       "      <td>601258.SH</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>279</th>\n",
       "      <td>20120104</td>\n",
       "      <td>399300.SZ</td>\n",
       "      <td>20161209</td>\n",
       "      <td>601992.SH</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>280</th>\n",
       "      <td>20120104</td>\n",
       "      <td>399300.SZ</td>\n",
       "      <td></td>\n",
       "      <td>002594.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>281</th>\n",
       "      <td>20120702</td>\n",
       "      <td>399300.SZ</td>\n",
       "      <td></td>\n",
       "      <td>601901.SH</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>282</th>\n",
       "      <td>20120104</td>\n",
       "      <td>399300.SZ</td>\n",
       "      <td>20150612</td>\n",
       "      <td>002603.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>283</th>\n",
       "      <td>20141215</td>\n",
       "      <td>399300.SZ</td>\n",
       "      <td></td>\n",
       "      <td>300251.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>284</th>\n",
       "      <td>20120702</td>\n",
       "      <td>399300.SZ</td>\n",
       "      <td></td>\n",
       "      <td>601669.SH</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>285</th>\n",
       "      <td>20140616</td>\n",
       "      <td>399300.SZ</td>\n",
       "      <td></td>\n",
       "      <td>601225.SH</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>286</th>\n",
       "      <td>20120702</td>\n",
       "      <td>399300.SZ</td>\n",
       "      <td></td>\n",
       "      <td>601555.SH</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>287</th>\n",
       "      <td>20130104</td>\n",
       "      <td>399300.SZ</td>\n",
       "      <td></td>\n",
       "      <td>601800.SH</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>288</th>\n",
       "      <td>20120702</td>\n",
       "      <td>399300.SZ</td>\n",
       "      <td>20170609</td>\n",
       "      <td>601928.SH</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>289</th>\n",
       "      <td>20130104</td>\n",
       "      <td>399300.SZ</td>\n",
       "      <td></td>\n",
       "      <td>002673.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>290</th>\n",
       "      <td>20120702</td>\n",
       "      <td>399300.SZ</td>\n",
       "      <td></td>\n",
       "      <td>601336.SH</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>291</th>\n",
       "      <td>20140616</td>\n",
       "      <td>399300.SZ</td>\n",
       "      <td>20151211</td>\n",
       "      <td>601929.SH</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>292</th>\n",
       "      <td>20131216</td>\n",
       "      <td>399300.SZ</td>\n",
       "      <td>20151211</td>\n",
       "      <td>002653.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>293</th>\n",
       "      <td>20131216</td>\n",
       "      <td>399300.SZ</td>\n",
       "      <td>20160608</td>\n",
       "      <td>601231.SH</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>294</th>\n",
       "      <td>20131216</td>\n",
       "      <td>399300.SZ</td>\n",
       "      <td>20170609</td>\n",
       "      <td>603000.SH</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>295</th>\n",
       "      <td>20130701</td>\n",
       "      <td>399300.SZ</td>\n",
       "      <td></td>\n",
       "      <td>603993.SH</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>296</th>\n",
       "      <td>20141215</td>\n",
       "      <td>399300.SZ</td>\n",
       "      <td>20160608</td>\n",
       "      <td>603288.SH</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>297</th>\n",
       "      <td>20140616</td>\n",
       "      <td>399300.SZ</td>\n",
       "      <td>20150612</td>\n",
       "      <td>603699.SH</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>298</th>\n",
       "      <td>20130918</td>\n",
       "      <td>399300.SZ</td>\n",
       "      <td></td>\n",
       "      <td>000333.SZ</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>299</th>\n",
       "      <td>20140616</td>\n",
       "      <td>399300.SZ</td>\n",
       "      <td></td>\n",
       "      <td>600023.SH</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>300 rows × 4 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      in_date index_code  out_date     symbol\n",
       "0    20050408  399300.SZ            000001.SZ\n",
       "1    20050408  399300.SZ            000002.SZ\n",
       "2    20050408  399300.SZ  20171208  000009.SZ\n",
       "3    20050408  399300.SZ  20151229  000024.SZ\n",
       "4    20140616  399300.SZ  20170609  000027.SZ\n",
       "5    20050408  399300.SZ  20170609  000039.SZ\n",
       "6    20050408  399300.SZ            000060.SZ\n",
       "7    20050408  399300.SZ  20170609  000061.SZ\n",
       "8    20050408  399300.SZ            000063.SZ\n",
       "9    20050408  399300.SZ            000069.SZ\n",
       "10   20090105  399300.SZ            000100.SZ\n",
       "11   20130701  399300.SZ  20171208  000156.SZ\n",
       "12   20050408  399300.SZ            000157.SZ\n",
       "13   20131216  399300.SZ  20160608  000400.SZ\n",
       "14   20050408  399300.SZ  20150612  000401.SZ\n",
       "15   20050408  399300.SZ            000402.SZ\n",
       "16   20140616  399300.SZ            000413.SZ\n",
       "17   20080102  399300.SZ            000423.SZ\n",
       "18   20050408  399300.SZ            000425.SZ\n",
       "19   20140616  399300.SZ            000503.SZ\n",
       "20   20131216  399300.SZ  20150612  000536.SZ\n",
       "21   20050701  399300.SZ            000538.SZ\n",
       "22   20141215  399300.SZ            000559.SZ\n",
       "23   20060703  399300.SZ  20150123  000562.SZ\n",
       "24   20050408  399300.SZ            000568.SZ\n",
       "25   20120104  399300.SZ  20160608  000581.SZ\n",
       "26   20131216  399300.SZ  20160608  000598.SZ\n",
       "27   20090105  399300.SZ            000623.SZ\n",
       "28   20050408  399300.SZ            000625.SZ\n",
       "29   20120104  399300.SZ  20160608  000629.SZ\n",
       "..        ...        ...       ...        ...\n",
       "270  20110701  399300.SZ  20161209  601098.SH\n",
       "271  20110104  399300.SZ            601818.SH\n",
       "272  20110701  399300.SZ            002500.SZ\n",
       "273  20140616  399300.SZ  20161209  600998.SH\n",
       "274  20141215  399300.SZ  20170609  300146.SZ\n",
       "275  20110701  399300.SZ            601933.SH\n",
       "276  20120702  399300.SZ  20151211  002570.SZ\n",
       "277  20140616  399300.SZ            601216.SH\n",
       "278  20120104  399300.SZ  20170609  601258.SH\n",
       "279  20120104  399300.SZ  20161209  601992.SH\n",
       "280  20120104  399300.SZ            002594.SZ\n",
       "281  20120702  399300.SZ            601901.SH\n",
       "282  20120104  399300.SZ  20150612  002603.SZ\n",
       "283  20141215  399300.SZ            300251.SZ\n",
       "284  20120702  399300.SZ            601669.SH\n",
       "285  20140616  399300.SZ            601225.SH\n",
       "286  20120702  399300.SZ            601555.SH\n",
       "287  20130104  399300.SZ            601800.SH\n",
       "288  20120702  399300.SZ  20170609  601928.SH\n",
       "289  20130104  399300.SZ            002673.SZ\n",
       "290  20120702  399300.SZ            601336.SH\n",
       "291  20140616  399300.SZ  20151211  601929.SH\n",
       "292  20131216  399300.SZ  20151211  002653.SZ\n",
       "293  20131216  399300.SZ  20160608  601231.SH\n",
       "294  20131216  399300.SZ  20170609  603000.SH\n",
       "295  20130701  399300.SZ            603993.SH\n",
       "296  20141215  399300.SZ  20160608  603288.SH\n",
       "297  20140616  399300.SZ  20150612  603699.SH\n",
       "298  20130918  399300.SZ            000333.SZ\n",
       "299  20140616  399300.SZ            600023.SH\n",
       "\n",
       "[300 rows x 4 columns]"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "df, msg = api.query(\n",
    "                view=\"lb.income\", \n",
    "                fields=\"\", \n",
    "                filter=\"\", \n",
    "                data_format='pandas')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'0,'"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "msg"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [],
   "source": [
    "df_data, msg = api.query(\n",
    "    view = 'lb.secDailyIndicator', \n",
    "    filter=\"start_date=20180404&end_date=20180404&symbol=600519.SH\",\n",
    "    fields='total_mv,float_mv,pe_ttm,pb,trade_date'\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>float_mv</th>\n",
       "      <th>pb</th>\n",
       "      <th>pe_ttm</th>\n",
       "      <th>symbol</th>\n",
       "      <th>total_mv</th>\n",
       "      <th>trade_date</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>8.718138e+07</td>\n",
       "      <td>9.5331</td>\n",
       "      <td>32.1948</td>\n",
       "      <td>600519.SH</td>\n",
       "      <td>8.718138e+07</td>\n",
       "      <td>20180404</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "       float_mv      pb   pe_ttm     symbol      total_mv trade_date\n",
       "0  8.718138e+07  9.5331  32.1948  600519.SH  8.718138e+07   20180404"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
